<template>
  <div class="InvoiceInfo">
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/' }"
        ><i class="lh fw_300 lh-seller fz_20"></i
      ></el-breadcrumb-item>
      <el-breadcrumb-item :to="{ path: '/invoice-list' }"
        >发票管理</el-breadcrumb-item
      >
      <el-breadcrumb-item>发票详情</el-breadcrumb-item>
    </el-breadcrumb>
    <div class="content_Box box-shadow mt_15 pl_10 pr_10">
      <div class="essential-box">
        <div class="title">发票详情</div>
        <el-row :gutter="20" class="border">
          <el-col :span="7">
            <div class="grid-content">
              <div class="key">发票申请编号：</div>
              <div class="val">{{ detail.sn }}</div>
            </div>
          </el-col>
          <el-col :span="7">
            <div class="grid-content">
              <div class="key">发票状态：</div>
              <div class="val">{{ detail.status_name }}</div>
            </div> </el-col
          >
          <el-col :span="7" v-if="detail.status == 30">
            <div class="grid-content">
              <div class="key">作废原因：</div>
              <div class="val">{{ detail.invalid_remark }}</div>
            </div>
          </el-col>
          <el-col :span="7" v-if="detail.status == 40">
            <div class="grid-content">
              <div class="key">驳回原因：</div>
              <div class="val">{{ detail.reject_remark }}</div>
            </div>
          </el-col>
          <el-col :span="7">
            <div class="grid-content">
              <div class="key">发票类型：</div>
              <div class="val">{{ detail.type_name }}</div>
            </div>
          </el-col>
          <el-col :span="7">
            <div class="grid-content">
              <div class="key">店铺名称：</div>
              <div class="val">{{ detail.shop_name }}</div>
            </div> </el-col
          ><el-col :span="7">
            <div class="grid-content">
              <div class="key">店铺编号：</div>
              <div class="val">{{ detail.shop_sn }}</div>
            </div>
          </el-col>
          <el-col :span="7">
            <div class="grid-content">
              <div class="key">公司名称：</div>
              <div class="val">{{ detail.company_name }}</div>
            </div>
          </el-col>
          <el-col :span="7">
            <div class="grid-content">
              <div class="key">公司税号：</div>
              <div class="val">{{ detail.company_tfn }}</div>
            </div>
          </el-col>
          <el-col :span="7">
            <div class="grid-content">
              <div class="key">公司地址：</div>
              <div class="val">{{ detail.company_address }}</div>
            </div>
          </el-col>
          <el-col :span="7">
            <div class="grid-content">
              <div class="key">注册电话：</div>
              <div class="val">{{ detail.company_phone }}</div>
            </div>
          </el-col>
          <el-col :span="7">
            <div class="grid-content">
              <div class="key">开户银行：</div>
              <div class="val">{{ detail.bank_branch_name }}</div>
            </div>
          </el-col>
          <el-col :span="7">
            <div class="grid-content">
              <div class="key">银行账号：</div>
              <div class="val">{{ detail.bank_card_id }}</div>
            </div>
          </el-col>
          <el-col :span="21">
            <div class="grid-content">
              <div class="key">备注：</div>
              <div class="val">{{ detail.apply_remark }}</div>
            </div>
          </el-col>
          <el-col :span="7">
            <div class="grid-content">
              <div class="key">收件人：</div>
              <div class="val">{{ detail.recipients_name }}</div>
            </div>
          </el-col>
          <el-col :span="14">
            <div class="grid-content">
              <div class="key">收件人手机号：</div>
              <div class="val">{{ detail.recipients_phone }}</div>
            </div>
          </el-col>
          <el-col :span="21">
            <div class="grid-content">
              <div class="key">收件地址：</div>
              <div class="val">{{ detail.recipients_address }}</div>
            </div>
          </el-col>
          <el-col :span="21">
            <div class="grid-content">
              <div class="key">发票编号：</div>
              <div class="val">{{ detail.invoice_code }}</div>
            </div>
          </el-col>
          <el-col :span="7">
            <div class="grid-content">
              <div class="key">快递公司：</div>
              <div class="val">{{ detail.express_company_name }}</div>
            </div>
          </el-col>
          <el-col :span="14">
            <div class="grid-content">
              <div class="key">快递单号：</div>
              <div class="val">{{ detail.express_code }}</div>
            </div>
          </el-col>
          <el-col :span="21">
            <div class="grid-content">
              <div class="key">开票备注：</div>
              <div class="val">{{ detail.make_remark }}</div>
            </div>
          </el-col>
          <el-col :span="21">
            <div class="grid-content">
              <div class="key">操作记录：</div>
              <div class="val">
                  <p v-for="(item,index) in detail.action_log" :key="index">
                    {{ item.op_user_name }} &nbsp; {{ item.add_time_str }} &nbsp; {{ item.invoice_status_action }}
                  </p>
              </div>
            </div>
          </el-col>
        </el-row>
        <div class="submitBox mt_30">
            <span class="resetBtn " @click="returnBtn">返回</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { invoiceDetail } from "@/api/invoice.js"
export default {
  name: "",
  data() {
    return {
      detail: {}, //发票信息
    };
  },
  mounted() {
    this.fetchInvoiceDetail(this.$route.query.sn);
  },
  methods: {
    //获取发票信息
    async fetchInvoiceDetail(sn) {
      try {
        let res = await invoiceDetail({
          sn: sn
        });
        this.detail = res
      } catch (err) {
        console.log("发票详情："+err);
      }
    },
    //返回
    returnBtn(){
        this.$router.go('-1');
    }
  }
};
</script>

<style lang="scss" scoped>
.essential-box {
  margin-bottom: 30px;
}
.essential-box .grid-content {
  display: flex;
  height: auto !important;
  padding: 10px 0;
  height: 30px;
  line-height: 30px;
}
.essential-box .grid-content .key {
  width: 110px;
  font-size: 13px;
  color: #999999;
  text-align: right;
}
.essential-box .grid-content .val {
  font-size: 14px;
  padding-left: 20px;
  color: #222222;
  flex: 1;
  word-break: break-all;
}
.sign-audit-btn {
  margin-left: 20px;
  font-size: 12px;
  padding: 3px 10px;
}
.audit-dialog {
  display: flex;
  padding-bottom: 20px;
}
.audit-dialog .key {
  width: 100px;
  color: #999999;
}
.InvoiceInfo .edit-btn .el-button.is-round {
  padding: 10px 20px;
}
.InvoiceInfo
  .el-radio-button__orig-radio:disabled:checked
  + .el-radio-button__inner {
  background: #3a54e2;
}
.title {
  font-size: 16px;
  color: #333;
  font-weight: bold;
  border-bottom: 1px solid #d4d4d4;
  padding: 5px 10px 15px 10px;
}
.border {
  border: 1px solid #d4d4d4;
  margin: 10px 0 !important;
}
.submitBox{
    text-align: center;
}
</style>



// WEBPACK FOOTER //
// src/components/invoice/Details.vue